﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace AACalc.ViewModels
{
    public class Activity : INotifyPropertyChanged
    {
        private string name;
        private DateTime time;
        private double cost;

        public ObservableCollection<Attendee> Attendees { get; private set; }

        public Activity()
        {
            this.time = DateTime.Now;
            this.Attendees = new ObservableCollection<Attendee>();
        }

        public string Name
        {
            get
            {
                return this.name;
            }

            set
            {
                if (value != this.name)
                {
                    this.name = value;
                    this.NotifyPropertyChanged("Name");
                }
            }
        }

        public DateTime Time
        {
            get
            {
                return this.time;
            }
        }

        public double Cost
        {
            get
            {
                return this.cost;
            }

            set
            {
                if (!this.cost.Equals(value))
                {
                    this.cost = value;
                    this.NotifyPropertyChanged("Cost");
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;

            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
